﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public class ThuocTinhDAL
    {
        DataHelper dh = new DataHelper();

        public DataTable laynhomthuoctinh(int masp)
        {
            //DataTable bang = db.layDulieu("select Manhomthuoctinh,Tennhomthuoctinh from NhomThuocTinh where Manhom=(select Manhom from SanPham where Masanpham='" + masp + "')");
            SqlParameter para = new SqlParameter("masp", masp);
            DataTable bang = dh.FieldSortTableSP("sp_laynhomthuoctinh", para);
            return bang;
        }
        public DataTable laythuoctinh(int manhomtt,int masp)
        {
            //DataTable bang = db.layDulieu("select h1.Mathuoctinh,Tenthuoctinh,Giatri from ThuocTinhSanPham h1 join ChiTietSanPham h2 on h1.Mathuoctinh=h2.Mathuoctinh where Manhomthuoctinh='"+manhomtt+"'");
            SqlParameter para = new SqlParameter("manhomtt", manhomtt);
            SqlParameter para2 = new SqlParameter("masp", masp);
            DataTable bang = dh.FieldSortTableSP("sp_laychitietthuoctinh", para,para2);
            return bang;
        }
        //public DataTable getthuoctinhloc(int manhom)
        //{
        //    DataTable dt = null;
        //    try
        //    {
        //        SqlParameter para = new SqlParameter("@manhom", manhom);
        //        dt = dh.FieldSortTableSP("tt_getthuoctinhloc", para);
        //    }
        //    catch (Exception)
        //    {              
        //        throw;
        //    }
        //    return dt;
        //}
    }
}
